sgdk: vdp_spr.h File Reference

sgdk

- Main Page
- Related Pages
- Classes
- Files

- File List
- File Members

Classes | Defines | Functions | Variables
vdp_spr.h File Reference

VDP Sprite support. More...

Go to the source code of this file.

## Classes

struct | SpriteDef

## Defines

#define | MAX_SPRITE 80
#define | SPRITE_SIZE(w, h) ((((w) - 1) << 2) | ((h) - 1))

## Functions

void | VDP_resetSprites ()
| Reset all sprites.
void | VDP_setSprite (u16 index, s16 x, s16 y, u8 size, u16 tile_attr, u8 link)
| Set a sprite (use sprite list cache).
void | VDP_setSpriteP (u16 index, const SpriteDef *sprite)
| Set a sprite (use sprite list cache).
void | VDP_setSpriteDirect (u16 index, s16 x, s16 y, u8 size, u16 tile_attr, u8 link)
| Set a sprite (direct send to VDP).
void | VDP_setSpriteDirectP (u16 index, const SpriteDef *sprite)
| Set a sprite (direct send to VDP).
void | VDP_setSpritePosition (u16 index, s16 x, s16 y)
| Set sprite position (use sprite list cache).
void | VDP_setSprites (u16 index, const SpriteDef *sprites, u16 num)
| Set severals sprites (use sprite list cache).
void | VDP_setSpritesDirect (u16 index, const SpriteDef *sprites, u16 num)
| Set severals sprites (direct send to VDP).
void | VDP_updateSprites ()
| Send the cached sprite list to the VDP.

## Variables

SpriteDef | vdpSpriteCache [MAX_SPRITE]
| VDP sprite definition cache.

## Detailed Description

VDP Sprite support.

Author:
  Stephane Dallongeville

Date:
  08/2011

This unit provides methods to manipulate the VDP Sprites.
The Sega Genesis VDP can handle up to 80 simultanous sprites of 4x4 tiles (32x32 pixels).

## Define Documentation

#define MAX_SPRITE 80

Maximum number of sprite

#define SPRITE_SIZE | ( |  | w,
|  |  | h
| ) |  | ((((w) - 1) << 2) | ((h) - 1))

Helper to define sprite size in sprite definition structure.

Parameters:

  w | sprite width (in tile).
  h | sprite height (in tile).

## Function Documentation

void VDP_resetSprites | ( |  | ) |

Reset all sprites.

Clear the sprite list.

void VDP_setSprite | ( | u16 | index,
|  | s16 | x,
|  | s16 | y,
|  | u8 | size,
|  | u16 | tile_attr,
|  | u8 | link
| ) |  |

Set a sprite (use sprite list cache).

Parameters:

  index | Index of the sprite to set (should be < MAX_SPRITE).
  x | Sprite position X.
  y | Sprite position Y.
  size | Sprite size (see SPRITE_SIZE() macro).
  tile_attr | Sprite tile attributes (see TILE_ATTR_FULL() macro).
  link | Sprite link (index of next sprite, 0 for end).

void VDP_setSpriteDirect | ( | u16 | index,
|  | s16 | x,
|  | s16 | y,
|  | u8 | size,
|  | u16 | tile_attr,
|  | u8 | link
| ) |  |

Set a sprite (direct send to VDP).

Parameters:

  index | Index of the sprite to set (should be < MAX_SPRITE).
  x | Sprite position X.
  y | Sprite position Y.
  size | Sprite size (see SPRITE_SIZE() macro).
  tile_attr | Sprite tile attributes (see TILE_ATTR_FULL() macro).
  link | Sprite link (index of next sprite, 0 for end).

See VDP_setSprite().

void VDP_setSpriteDirectP | ( | u16 | index,
|  | const SpriteDef * | sprite
| ) |  |

Set a sprite (direct send to VDP).

Parameters:

  index | Index of the sprite to set (should be < MAX_SPRITE).
  sprite | Sprite definition.

See VDP_setSpriteP().

void VDP_setSpriteP | ( | u16 | index,
|  | const SpriteDef * | sprite
| ) |  |

Set a sprite (use sprite list cache).

Parameters:

  index | Index of the sprite to set (should be < MAX_SPRITE).
  sprite | Sprite definition.

See VDP_setSprite().

void VDP_setSpritePosition | ( | u16 | index,
|  | s16 | x,
|  | s16 | y
| ) |  |

Set sprite position (use sprite list cache).

Parameters:

  index | Index of the sprite to modify position (should be < MAX_SPRITE).
  x | Sprite position X.
  y | Sprite position Y.

See VDP_setSprite().

void VDP_setSprites | ( | u16 | index,
|  | const SpriteDef * | sprites,
|  | u16 | num
| ) |  |

Set severals sprites (use sprite list cache).

Parameters:

  index | Index of first sprite to set (should be < MAX_SPRITE).
  sprites | Sprite definitions.
  num | Number of sprite to set.

See VDP_setSpritesDirect().

void VDP_setSpritesDirect | ( | u16 | index,
|  | const SpriteDef * | sprites,
|  | u16 | num
| ) |  |

Set severals sprites (direct send to VDP).

Parameters:

  index | Index of first sprite to set.
  sprites | Sprite definitions.
  num | Number of sprite to set.

See VDP_setSprites().

void VDP_updateSprites | ( |  | ) |

Send the cached sprite list to the VDP.

You should call this method when you completed your sprite update task.

All Classes Files Functions Variables Typedefs Enumerations Defines